package com.ebupt.migu.music.schedule;

import com.ebupt.migu.music.schedule.service.RedisTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * Created by Intellij IDEA.
 * User:  liuyangyang@cd.ebupt.com
 * Date:  2020/3/17
 */
@Slf4j
@Component
@EnableScheduling
public class RedisTask {

    @Autowired
    private RedisTaskService redisTaskService;

    /**
     * 删除已失效和已删除的人群在Redis种对应的KEY
     */
  //  @Scheduled(cron = "${cron.redis_common}")
    public void cleanRedis() {
        redisTaskService.cleanRedis();
    }

    /**
     * 1、DPI人群：
     * msisdn - 人群规模
     * 无其他规模
     * 2、非DPI人群：
     * uid - 人群规模、客户端规模
     * msisdn - 手机号码规模
     */
    // @Scheduled(cron = "${cron.redis_common}")
    public void updateUserGroupSize() {
        redisTaskService.updateUserGroupSize();
    }
}
